Label class options


The following options govern the labelling of objects.

-accelerator string (CS)
Sets the button widgets accelerator. (Accelerators are keystroke combinations, usually involving <Control> or <Alt> keys to distinguish them from ordinary keystrokes to be sent to the application, that invoke a menu or a menu item even when the menu is not displayed.)

The accelerator string format is like that of a translation, but allows only a single key press event to be specified. For example, to specify the accelerator <Ctrl>N, the string Ctrl<Key>N is used.

-acceleratorString string (CS)
Sets the text that is displayed for the accelerator. The string is displayed adjacent to the label string or pixmap. For example the string usually used to specify that <Ctrl>N is the accelerator is Ctrl+N. Accelerator text for buttons is displayed only for PushButtons and ToggleButtons in Pulldown and Popup Menus.

-label string (CSG)
String that is to be displayed in the widget.

-pixmap filename (CS)
Sets the pixmap to use in a Label or subclass of a Label. If you just specify this without specifying insensitivePixmap or armedPixmap, those two pixmaps will be automatically generated for you.

-insensitivePixmap filename (CS)
Sets the pixmap to use when the object is insensitive. Do not set this if you want it generated for you.

-labelCenter (CS)
Centers the label within the widget.

-labelLeft (CS)
Left aligns the label within the widget.

-labelRight (CS)
Right aligns the label within the widget.

-mnemonic char (CS)
To make menu functions even more convenient, menus can have mnemonics associated with them. A mnemonic is a letter in a menu button label that can be pressed to activate the button. The first character in the label string that exactly matches the mnemonic is underlined when the button is displayed.

Note that when you specify a mnemonic for a Pulldown Menu, both the character and graphical servers automatically add <Alt>mnemonic as an accelerator for the menu.

-recomputeSize boolean (CS)
Sets whether the widget shrinks or expands to accommodate its content (label or pixmap). This option is only recognized by the graphical server. The default is True. If True, the widget shrinks or expands to exactly fit the label string or pixmap. If False, the widget never attempts to change size on its own.

If you have a label that is going to have several strings of different lengths displayed in it, you may want to use the -recomputeSize FALSE option. This ensures that the label does not resize every time a string is displayed. If you allow the label to resize, the form will also resize around it unless you specified the -resizable FALSE option on your form. When you use -recomputeSize FALSE on your label, make sure that your label is the size you want it to be when it is created. You can do this by using attachments to the form or other widgets, or you can specify the width of the label.